package com.pactera.asmp.server.common.constants;


/**
 * ResultCode
 */
public enum ResultCode {

    /* 成功状态码 */
    SUCCESS(200,"Success"),

    /* 错误状态码 */
    FAIL(-1,"Fail"),

    /* 参数错误：10001-19999 */
    PARAM_IS_INVALID(10001, "参数无效"),
    PARAM_IS_BLANK(10002, "参数为空"),
    PARAM_TYPE_BIND_ERROR(10003, "参数格式错误"),
    PARAM_NOT_COMPLETE(10004, "参数缺失"),
    PARAM_NOT_EQUAL(10005, "数据不一致"),
    PARAM_DUPLICATION(10006, "数据重复"),
    PARAM_IN_USED(10007, "項目使用中，不能刪除"),

    /* 用户错误：20000-29999*/
    USER_LOGGED_IN_SUCCESS(20000, "用户登录成功"),
    USER_NOT_LOGGED_IN(20001, "用户未登录，请先登录"),
    USER_LOGIN_ERROR(20002, "账号不存在或密码错误"),
    USER_ACCOUNT_FORBIDDEN(20003, "账号已被禁用"),
    USER_NOT_EXIST(20004, "用户不存在"),
    USER_HAS_EXISTED(20005, "用户已存在"),
    USER_STATUE_LOCK(20006, "账户已锁定"),
    USER_STATUE_LOCK_MAX_TIP(20007, "用户登录，用户验证未通过：错误次数大于5次,账户已锁定,2分钟后可再次登录，或联系管理员解锁"),
    USER_STATUE_KIKOFF(20008, "您已在别处登录，请您修改密码或重新登录"),
    USER_PASSWORD_ERROR(20009, "原密码错误，请重新输入"),

    /* 业务错误：30001-39999 */
    BUSINESS_GROUP_NO_ALLOWED_DEL(30001, "应用分组已经被应用使用，不能删除"),
    BUSINESS_THEME_NO_ALLOWED_DEL(30002, "主题已经被用户使用，不能删除"),
    BUSINESS_THEME_NO_ALLOWED_DISABLE(30003, "主题已经被用户使用，不能停用"),
    BUSINESS_THEME_DEFAULT_NO_ALLOWED_DEL(30004, "默认主题，不能删除"),
    BUSINESS_THEME_NO_ALLOWED_UPDATE(30005, "主题已经被用户使用，不能修改图片信息"),
    BUSINESS_IS_TOP(30040, "已经到最顶部"),
    BUSINESS_IS_BOTTOM(30041, "已经到最底部"),
    BUSINESS_NAME_EXISTED(30051, "名称已存在"),
    BUSINESS_DEVICE_BIND_ERR(30052, "设备绑定失败或已经被其他用户绑定"),
    BUSINESS_DEVICE_OPER_ERR(30053, "设备操作失败，请刷新后重试"),

    BUSINESS_PROJECT_NOT_FIND_ERR(30054, "查无指定项目"),
    BUSINESS_PROJECT_MODULE_BY_PROJECTID_ERR(30055, "获取指定项目的所有模块异常"),
    BUSINESS_TASK_NOT_FIND_ERR(30056, "查无指定任务"),
    BUSINESS_TASK_REMOVEJOB_ERR(30057, "取消任务失败"),
    BUSINESS_TASK_REMOVETASK_ERR(30066, "任务非失败状态，不能删除"),
    BUSINESS_DEVICE_BIND_MORE_ERR(30058, "您已经绑定了设备，请先解绑后再重新绑定新设备"),
//    BUSINESS_EXIST_ROLE_NAME_CODE_ERR(30059,"角色名称或角色编号已经存在"),
    BUSINESS_ROLE_LEVEL_ERR(30060,"角色等级越级异常"),
    BUSINESS_MENU_LEVEL_ERR(30061,"权限等级越级异常"),
    BUSINESS_NO_PERMISSION(30062, "暂无访问权限"),
    BUSINESS_NO_DATETIME(30062, "时间错误"),
    BUSINESS_PROJECT_DEVICE_UNBIND_FAIL(30063, "不能解绑项目下正在执行任务的设备"),
    BUSINESS_PROJECT_STATUS_ERR(30064, "项目状态异常"),
    BUSINESS_PROJECT_UPDATE_ERR(30065, "项目更新异常"),

    BUSINESS_PROJECT_SCRIPT_NOT_MATCH_ERR(30066, "项目与脚本不匹配"),
    BUSINESS_USER_CANNOT_DELETE_ROLE_ERR(30067, "当前权限无法删除该角色。"),
    BUSINESS_ROLE_CANNOT_DELETED_ERR(30068, "当前角色已有关联用户，不可删除。"),
    BUSINESS_ALL_DEVICE_OFFLINE_ERR(30069, "测试任务创建失败，请重试"),
//    BUSINESS_USECASE_REPEAT_ERR(30070, "该用例名称已存在，请重新输入"),

    BUSINESS_PROJECTNAME_EXISTED(30071, "项目名称已存在，请重新输入"),
    BUSINESS_USECASENAME_EXISTED(30072, "用例名称已存在，请重新输入"),
    BUSINESS_SCRIPTNAME_EXISTED(30073, "脚本名称已存在，请重新输入"),
    BUSINESS_CONSTANTNAME_EXISTED(30074, "常量名称已存在，请重新输入"),
    BUSINESS_USERNAME_EXISTED(30075, "用户名称已存在，请重新输入"),
    BUSINESS_ROLENAME_EXISTED(30076, "角色名称或角色编号已存在，请重新输入"),
    BUSINESS_PERMISSIONNAME_EXISTED(30077, "权限名称已存在，请重新输入"),
    BUSINESS_TESTTASK_EXISTED(30078, "测试任务名称已存在，请重新输入"),

    BUSINESS_DEVICE_EXISTED(30079, "上位机下已存在同类型的设备"),

    BUSINESS_NO_RELATED_PROJECT(30080, "该用户无关联项目"),

    BUSINESS_PROJECT_MODULE_SCRIPT_RELATED(30081, "模块已关联脚本无法删除"),

    BUSINESS_PROJECT_MODULE_CONSTANT_RELATED(30082, "模块已关联常量无法删除"),

    BUSINESS_CONSTANT_NOT_EXISTED(30083, "常量ID不存在，请重新保存为新常量"),
    BUSINESS_SCRIPT_NOT_EXISTED(30084, "脚本ID不存在，请重新保存为新脚本"),
    BUSINESS_CAMERA_NOT_EXISTED(30085, "摄像头不存在"),

    BUSINESS_LABNAME_EXISTED(30086, "实验室名称已存在，请重新输入"),

    BUSINESS_LAB_NOT_EXISTED(30087, "实验室不存在"),
    BUSINESS_LAB_CANNOT_DELETE(30088, "启用的实验室不能被删除"),

    BUSINESS_SCRIPT_PERFORMANCE_TYPE_NOT_SAME(30089, "任务所选的脚本非同为性能测试脚本或者同为非性能测试脚本"),

    BUSINESS_PROJECT_PRODUCTION_LINE_ERROR(30090, "数据获取失败，请确认URL/账号/密码信息"),
    BUSINESS_PROJECT_PRODUCTION_LINE_NOT_EXISTED(30091, "流水线数据不存在"),
    BUSINESS_PROJECT_PRODUCTION_LINE_CONFIG_NOT_EXISTED(30092, "流水线配置数据不存在"),
    BUSINESS_PROJECT_PRODUCTION_LINE_DEVICE_NOT_EXISTED(30093, "流水线配置上位机不存在设备"),
    BUSINESS_PROJECT_PRODUCTION_LINE_AUX_DEVICE_NOT_EXISTED(30093, "流水线配置上位机不存在辅助设备"),

    BUSINESS_PROJECT_MODULE_NOT_EXISTED(30094, "模块不存在"),
    BUSINESS_PROJECT_SCRIPT_NOT_EXISTED(30095, "脚本信息已被删除/不存在"),
    BUSINESS_PROJECT_SCRIPT_NOT_EXISTED_RESELECT(30096, "脚本信息已被删除/不存在,请重新选择"),
    BUSINESS_PROJECT_PRODUCTION_LINE_NOT_SUBSCRIBE(30097, "该流水线暂未订阅"),
    BUSINESS_PROJECT_PRODUCTION_CONFIG_ERROR(30098, "信息输入有误，请重新输入"),
    /* 系统错误：40001-49999 */
    SYSTEM_INNER_ERROR(40001, "系统异常，请稍后重试"),
    UPLOAD_ERROR(40002, "系统异常，上传文件失败"),
    FILE_MAX_SIZE_OVERFLOW(40003, "上传尺寸过大"),
    FILE_ACCEPT_NOT_SUPPORT(40004, "上传文件格式不支持"),
    SET_UP_AT_LEAST_ONE_ADMIN(40005, "至少指定一个管理员"),
    URL_INVALID(40006, "地址不合法"),
    LINK_AND_LOGOUT_NO_MATCH(40006, "主页地址和注销地址IP不一致"),
    IP_AND_PORT_EXISTED(40007, "当前IP和端口已经被占中"),
    LINK_IS_REQUIRED(40008, "生成第三方token认证信息： 主页地址不能为空,请完善信息"),
    ONLY_ROOT_DEPARTMENT(40009, "组织机构只能存在一个根机构"),
    DEPART_CODE_EXISTED(40010, "组织机构编码已存在"),
    DEPART_CONTAINS_USERS(40011, "该机构下是存在用户，不允许删除"),
    DEPART_CONTAINS_SON(40012, "该机构下是存在子级机构，不允许删除"),
    DEPART_PARENT_IS_SELF(40013, "选择的父机构不能为本身"),
    DICT_EXIST_DEPEND(40014, "该字典数据存在详情依赖，不允许删除"),
    DICT_DETAIL_LOCK(40015, "该字典数据被锁定，不允许修改或删除"),
    DEPART_CODE_EXISTED_WITH_ARGS(40016, "组织机构编码【{0}】系统已存在"),
    SYSTEM_TASK_TIME_ERROR(40017, "延期时间设置小于当前时间"),
    DEVICE_OFFLINE(40018, "设备离线"),
    DEVICE_NOT_AVAILABLE(40019, "设备不可用"),
    FILE_PARSE_FAIL(40020, "文件解析异常"),
    FILE_EMPTY(40021, "上传文件中无可用数据"),
    DEVICE_NOTEXIST_OR_OFFLINE(40022, "设备不存在或者已离线"),

    /* 数据错误：50001-599999 */
    RESULT_DATA_NONE(50001, "数据未找到"),
    DATA_IS_WRONG(50002, "数据有误"),
    DATA_ALREADY_EXISTED(50003, "数据已存在"),

    /* 接口错误：60001-69999 */
    INTERFACE_INNER_INVOKE_ERROR(60001, "内部系统接口调用异常"),
    INTERFACE_OUTTER_INVOKE_ERROR(60002, "外部系统接口调用异常"),
    INTERFACE_FORBID_VISIT(60003, "该接口禁止访问"),
    INTERFACE_ADDRESS_INVALID(60004, "接口地址无效"),
    INTERFACE_REQUEST_TIMEOUT(60005, "接口请求超时"),
    INTERFACE_EXCEED_LOAD(60006, "接口负载过高"),
    INTERFACE_OPERATION_INVOKE_ERROR(60007, "系统内部接口调用异常"),


    /* 权限错误：70001-79999 */
    PERMISSION_UNAUTHENTICATED(70001,"此操作需要登陆系统！"),
    PERMISSION_UNAUTHORISE(70002,"权限不足，无权操作！"),
    PERMISSION_EXPIRE(70003,"登录状态过期！"),
    PERMISSION_TOKEN_EXPIRED(70004, "Token失效，请重新登录"),
    PERMISSION_LIMIT(70005, "访问次数受限制"),
    PERMISSION_TOKEN_INVALID(70006, "无效token"),
    PERMISSION_SIGNATURE_ERROR(70007, "签名失败"),
    PERMISSION_TOKEN_LACK(70008, "Token数据缺失"),
    PERMISSION_DEVICE_TOKEN_INVALID(70009, "设备Token数据失效，需要设备端重新调用注册系统/重新登录获取新Token"),
    PERMISSION_USER_DELETE(70010, "用户不存在，请重新登录"),
    PERMISSION_USER_LOGIN_OTHER_PLACE(70011, "账号已在其他设备登录，请注意密码安全");

    //操作代码
    int code;
    //提示信息
    String message;
    ResultCode(int code, String message){
        this.code = code;
        this.message = message;
    }

    public int code() {
        return code;
    }

    public String message() {
        return message;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public void setMessage(String message) {
        this.message = message;
    }
}
